﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Direct.Mvc;
using Direct.ApplicationModel;

namespace Direct.Server.Modules.Shell.Application.Controllers
{
    public class ShellController : ServerControllerBase
    {
        public ActionResult Index()
        {
            var user = AppUser.Current;
            if (user == null)
                return Redirect("/r/auth");

            var shell = ServiceLocator
                .GetInstance<IApplicationModelService>()
                .GetApplication(ShellConstants.ApplicationId);

            //usuario corrente
            ViewData["usr_login"] = user.Login;
            ViewData["usr_name"] = user.Name;
            ViewData["menu_items"] = shell.Commands.GetItemsForUser(ShellMenus.Start, user);
            ViewData["tool_links"] = shell.Commands.GetItemsForUser(ShellMenus.Tools, user);
            return View("ShellDesktop");
        }
    }
}
